package com.zjl.servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zjl.dao.impl.StudentDaoImpl;
import com.zjl.entity.StudentEntity;
import com.zjl.util.BaseServlet;

/**
 * Servlet implementation class StudentServlet
 */
public class StudentServlet extends BaseServlet {
	StudentDaoImpl sDaoImpl = new StudentDaoImpl();
	public void selectAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String name = request.getParameter("name");
		ArrayList<StudentEntity> arrayList = sDaoImpl.selectAll(name);
		request.setAttribute("alist", arrayList);
		request.setAttribute("name",name);
		request.getRequestDispatcher("list.jsp").forward(request, response);
	}
		public void userDetail(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			int id = Integer.parseInt(request.getParameter("id"));
			StudentEntity list=sDaoImpl.userDetail(id);
			  request.setAttribute("user", list);
			request.getRequestDispatcher("userDetail.jsp").forward(request, response);
		}

}
